package com.ly.count.impl.score;
 
import com.ly.count.impl.score.transfer.CPlusRoomScoreTransfer;
import com.ly.count.score.mapper.CPlusRoomScoreRecordMapper;
import com.ly.count.score.param.CPlusRoomScorePage;
import com.ly.count.score.po.CPlusRoomScoreRecord;
import com.ly.count.service.score.CPlusRoomScoreRecordService;
import com.ly.count.http.CPlusResponse;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ly.count.utils.ResponseModelUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
 * Module: CPlusRoomScoreRecord.java
 * 
 * @author liaoyong
 * @since JDK 1.8
 * @version 1.0
 * @date 2024-10-03
 * @Descriptions:
 */
@Service("cPlusRoomScoreRecordService")
public class CPlusRoomScoreRecordServiceImpl extends ServiceImpl<CPlusRoomScoreRecordMapper, CPlusRoomScoreRecord> implements CPlusRoomScoreRecordService {
 		
 	public CPlusResponse<CPlusRoomScoreRecord> selectOne(CPlusRoomScoreRecord cPlusRoomScoreRecord){
 		Wrapper<CPlusRoomScoreRecord> queryWrapper = new QueryWrapper<>(cPlusRoomScoreRecord);
		return ResponseModelUtils.body(getOne(queryWrapper));
 	
 	}
	
	public CPlusResponse<Object>	add(CPlusRoomScoreRecord cPlusRoomScoreRecord){
		boolean result = save(cPlusRoomScoreRecord);
		if(result) {
			ResponseModelUtils.success();
		}
		return ResponseModelUtils.fail();
	}
	
	public CPlusResponse<Object>	modify(CPlusRoomScoreRecord cPlusRoomScoreRecord){

		
		boolean result = updateById(cPlusRoomScoreRecord);
		if(result) {
			ResponseModelUtils.success();
		}
		return ResponseModelUtils.fail();
	}
	
	public CPlusResponse<Page<CPlusRoomScoreRecord>> pageList(CPlusRoomScorePage cPlusRoomScorePage){
		 Page<CPlusRoomScoreRecord> page = CPlusRoomScoreTransfer.toPage(cPlusRoomScorePage);
		return ResponseModelUtils.body(page(page,new QueryWrapper<CPlusRoomScoreRecord>()));
	}
}
